package com.jjiang.bbmall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.jjiang.common.valid.AddGroup;
import com.jjiang.common.valid.ListValue;
import com.jjiang.common.valid.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 *
 * @author jingjiang
 * @email 1259029328@qq.com
 * @date 2022-11-01 14:06:17
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@NotNull(message = "修改时必须指定品牌id！", groups = {UpdateGroup.class})
	@Null(message = "新增时不能指定品牌id！", groups = {AddGroup.class})
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名必须不为空！", groups = {AddGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotBlank(message = "品牌logo地址必须不为空！", groups = {AddGroup.class})
	@URL(message = "品牌logo地址必须是合法的URL地址！", groups = {UpdateGroup.class, AddGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	@NotBlank(message = "品牌介绍必须不为空！", groups = {AddGroup.class})
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull(message = "显示状态必须不为空！", groups = {AddGroup.class})
	@ListValue(values = {0, 1}, message = "显示状态必须是0或1", groups = {UpdateGroup.class, AddGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotBlank(message = "检索首字母必须不为空！", groups = {AddGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母必须是一个字母！", groups = {UpdateGroup.class, AddGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull(message = "排序必须不为空！", groups = {AddGroup.class})
	@Min(value = 0, message = "排序必须是正整数", groups = {UpdateGroup.class, AddGroup.class})
	private Integer sort;

}
